package com.tenement.controller;


import com.alibaba.fastjson.JSONObject;
import com.tenement.common.Axios;
import com.tenement.enums.RespBusiness;
import com.tenement.service.ExploreService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/explore")
@RequiredArgsConstructor
@Api(tags = "探索页Api,公益性")
public class ExploreController {

    private final ExploreService exploreService;

    @ApiOperation("获取热门搜索歌曲")
    @GetMapping("/hotSearchMusic")
    public Axios hotSearchMusic()
    {
        JSONObject res = exploreService.hotSearchMusic();
        if (res.getBoolean("success")) {
            return Axios.success(res.getJSONObject("info"));
        }
        return Axios.error(RespBusiness.FAIL);
    }

}
